package com.hk.button;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import com.hk.global.ImageUrl;

public class ButtonSplit extends SuperButton {
	private int x = 700;
	private int y = 260;
	private int w = 130;
	private int h = 40;

	public ButtonSplit() {
		BoundsButton(x, y, w, h);
		SetButtonIcon(ImageUrl.B_SPLIT);
	}

	@Override
	protected void ActionButton() {
		button.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				if (true) {
//				if (ct.getTcu().getNumber(0)==ct.getTcu().getNumber(1)) {
					if (!pg.isEnd() && pg.isPlay() && !pg.isHit()) {
						if (!pg.isSplit()) {
							pg.setSplitbatting(pg.getBatting());
							pg.setSplit(true);
							ct.CardSplit();
						}
						ngLab.setSumsplitLab("" + ct.getTcus().getSum());
						ngLab.setSumuserLab("" + ct.getTcu().getSum());
						ngLab.updateLabel();
					}
				}
			}
		});
	}
	@Override
	public void HideButton() {
		BoundsButton(x, y, w, h);
	}
	@Override
	public void ShowButton() {
		BoundsButton(0, 0, 0, 0);
	}
	@Override
	public JButton getButton() {
		return button;
	}
}
